set -u
set -e 


# Get a "View" that contains all the directions/head_signs for the routes.
tail -n +2 trips.txt | cut -d, -f 1,4,5 | sort | uniq | sort -n -k 1 -t ,  > /tmp/t2.txt 
tail -n +2 routes.txt | cut -d, -f 1,2,5 | sort -n -k 1 -t ,  > /tmp/t3.txt
echo route_id,trip_headsign,direction_id,route_id,agency_id,route_type > directions.txt
join -t , -1 1 -2 1 /tmp/t2.txt /tmp/t3.txt >> directions.txt

